package mylab.starters.mq.impl;

import com.google.common.base.Preconditions;
import lombok.Getter;
import mylab.starters.mq.api.Client;
import mylab.starters.mq.api.Properties;

@Getter
public abstract class AbstractClient implements Client {

    protected Properties properties;
    protected String groupId;
    protected String clientId;

    public AbstractClient(Properties properties, String groupId, String clientId) {
        this.properties = properties;
        this.groupId = groupId;
        this.clientId = clientId;
    }

    public void checkParameters() {
        Preconditions.checkNotNull(this.properties, "properties is null");
        Preconditions.checkNotNull(this.properties.getBrokers(), "brokers is null");
        Preconditions.checkNotNull(this.groupId, "groupId is null");
        Preconditions.checkNotNull(this.clientId, "clientId is null");
    }
}
